package com.pinc.poop;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class day_grid extends LinearLayout {
	private TextView tv_day;
	private TextView tv_times;
	private ImageView iv_poop;
	private String datestr;

	public day_grid(Context context, int h) {
		super(context);
		LayoutInflater.from(context).inflate(R.layout.day_grid, this, true);

		tv_day = (TextView) findViewById(R.id.textView1);
		tv_times = (TextView) findViewById(R.id.textView2);
		iv_poop = (ImageView) findViewById(R.id.imageView1);
		MarginLayoutParams lp = new MarginLayoutParams(LayoutParams.FILL_PARENT,h);
		setLayoutParams(lp);
		tv_day.setTextColor(Color.rgb(180, 180, 180));
	}

	public void setCurMonth()
	{
		tv_day.setTextColor(Color.BLACK);
	}
	public void setDay(int n)
	{
		tv_day.setText(String.valueOf(n));
	}

	public void setTimes(int n)
	{
		if ( n > 0)
		{
			iv_poop.setVisibility(View.VISIBLE);
			if ( n > 1)
			{
				tv_times.setVisibility(View.VISIBLE);
				tv_times.setText(String.format("(%d)", n));
			}
		}
	}

	public void setToday(boolean today)
	{
		if ( today)
			tv_day.setTextColor(Color.RED);
	}

	public void setDateStr(String str)
	{
		datestr = str;
	}

	public String getDateStr()
	{
		return datestr;
	}

}
